package com.smzd.ccms.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.smzd.ccms.domain.CompletConfig;
import com.smzd.ccms.domain.CompletParamConfig;
import com.smzd.ccms.domain.Dict;
import com.smzd.ccms.mappers.CompletParamConfigMapper;
import com.smzd.core.dao.AbstractDao;
import com.smzd.core.mappers.IMapper;

@Component
public class CompletParamConfigDao extends AbstractDao<CompletParamConfig> {
	@Autowired
	private CompletParamConfigMapper mapper;

	@Override
	protected IMapper<CompletParamConfig> getMapper() {
		return mapper;
	}

	public List<CompletParamConfig> getAllCompletParamConfigs() {
		return mapper.getAllCompletParamConfigs();
	}

	public List<Dict> getCompletParamsByCompletConfig(CompletConfig ccfg) {
		return mapper.getCompletParamsByCompletConfig(ccfg);
	}

	public List<CompletParamConfig> getParamConfigsForCompletConfig(int id) {
		return mapper.getParamConfigsForCompletConfig(id);
	}

	public void updateValue(CompletParamConfig cpc) {
		mapper.updateValue(cpc);
	}

	public CompletParamConfig getCompletParamConfigByScopeKey(CompletConfig cconfig, String key) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("scopeid", cconfig.getId());
		params.put("key", key);
		return mapper.getCompletParamConfigByScopeKey(params);
	}

	public void disableCompletParamConfig(CompletParamConfig cpc) {
		mapper.disableCompletParamConfig(cpc);
	}
}